
export const tableMixin = {

    data() {
        return {
            page_no: 0,
            page_size: 10,
            form: {},
            tableLoading: false,
            total_size: 0,
            data_list: [],
            loading: false
        }
    },
    methods: {
        async clickExport(exportFunc) {
            if (!exportFunc) return
            const res = await exportFunc({ ...this.form, page_no: this.page_no, page_size: this.page_size })
            if (res.success) {
            } else {

            }
        },

        async clickQuery(queryFunc, callBack) {
            this.loading = true
            const data = await queryFunc({ ...this.form, page_no: this.page_no, page_size: this.page_size })
            if (data.success) {
                this.total_size = data.total
                this.data_list = data.dataList
                callBack && callBack({ data_list: data.dataList })
            } else {
                this.total_size = 0
                this.data_list = []
                callBack && callBack({ data_list: [] })
            }
            this.loading = false
        },
    },
}
